<?php
include_once("./_common.php");

$SQL = "DROP TABLE IF EXISTS `" . $g4['category_table'] . "`;";
sql_query($SQL);

$SQL = "CREATE TABLE IF NOT EXISTS `" . $g4['category_table'] . "` (
					`idx` int(10) unsigned NOT NULL auto_increment,
					`c_code` varchar(20) NOT NULL default '',
					`c_pcode` varchar(20) NOT NULL default '',
					`c_depth` varchar(10) NOT NULL default '',
					`c_name` varchar(40) NOT NULL default '',
					`c_sort` int(10) NOT NULL default '0',
					`c_show` char(1) NOT NULL default '1',
					`c_regday` datetime NOT NULL default '0000-00-00 00:00:00',
					PRIMARY KEY  (`idx`)
				) TYPE=MyISAM AUTO_INCREMENT=1 ;";
sql_query($SQL);


$SQL = "DROP TABLE IF EXISTS `" . $g4['goods_table'] . "`;";
sql_query($SQL);

$SQL = "CREATE TABLE IF NOT EXISTS `g4_goods` (
					`idx` int(10) unsigned NOT NULL auto_increment,
					`c_code` varchar(20) NOT NULL default '',
					`g_code` varchar(20) NOT NULL default '',
					`g_name` varchar(255) NOT NULL default '',
					`g_qty` int(5) NOT NULL default '1',
					`g_show` char(1) NOT NULL default '1',
					`g_order_flag` char(1) NOT NULL default '1',
					`g_order` int(6) NOT NULL default '0',
					`g_icon` varchar(50) NOT NULL default '',
					`g_info` varchar(255) NOT NULL default '',
					`g_sell_price` int(10) NOT NULL default '0',
					`g_price` int(10) unsigned NOT NULL default '0',
					`g_point` int(10) NOT NULL default '0',
					`g_option` text NOT NULL,
					`g_cnt` int(10) unsigned NOT NULL default '100',
					`g_min` int(10) unsigned NOT NULL default '0',
					`g_max` int(10) unsigned NOT NULL default '0',
					`g_create` varchar(50) NOT NULL default '',
					`g_nation` varchar(50) NOT NULL default '',
					`g_tranc` enum('Y','N','C') NOT NULL default 'Y',
					`g_content` text NOT NULL,
					`g_sale` int(10) unsigned NOT NULL default '0',
					`g_hit` int(10) unsigned NOT NULL default '0',
					`g_img1` varchar(100) NOT NULL default '',
					`g_img2` varchar(100) NOT NULL default '',
					`g_img3` varchar(100) NOT NULL default '',
					`g_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
					PRIMARY KEY  (`idx`)
				) TYPE=MyISAM AUTO_INCREMENT=1 ; ";
sql_query($SQL);

alert('그누샵 디비를 생성하였습니다.');
?>
